package converters;

import it.polimi.authentication.ejb.usermanagement.ListaEscursione;
import it.polimi.authentication.ejb.usermanagement.dto.EscursioneDTO;

import javax.ejb.EJB;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter(value="escursioneConverter")
public class converterEscursioni implements Converter {
	
	 @EJB
     private ListaEscursione LE;

     public converterEscursioni(){
     }

     public Object getAsObject(FacesContext context, UIComponent component, String value){
    	 return LE.thisEscursione(value);
     }

     public String getAsString(FacesContext context, UIComponent component, Object value)     
     {
    	 return (((EscursioneDTO) value).getNome()); //--> convert to a unique string.
     }
	

}
